<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<script type="text/javascript">
function changeMenu(){
	var allElements = document.getElementsByTagName('div');
	for(i=0;i<allElements.length;i++){
		if(allElements[i].className == 'menu_title'){
			allElements[i].onclick = changeStyle;
		}
	}
}
function changeStyle(){
	if (window.navigator.userAgent.indexOf("MSIE")>=0 ){
		var element = this.nextSibling;
	}else{
		var element = this.nextSibling.nextSibling;
	}
	var childElements = this.getElementsByTagName('span');
	for(i=0;i<childElements.length;i++){
		childElements[i].className = (childElements[i].className == 'put')?'put2':'put';
	}
	element.style.display = (element.style.display == 'none')?'block':'none';
}
window.onload = changeMenu;
</script>
<script language="JavaScript">
function change_style(flag) {
	if (flag =='style1'){
		document.getElementById('style1').className="current";
		document.getElementById('style2').className="";
		document.getElementById('display_order').style.display="block";
		document.getElementById('display_favorite').style.display="none";
	}
	if (flag =='style2'){
		document.getElementById('style1').className="";
		document.getElementById('style2').className="current";
		document.getElementById('display_order').style.display="none";
		document.getElementById('display_favorite').style.display="block";
	}
}
function get_img_list(itemid,i,imgid,page){
		ajax("do.php?act=shop_img_select","POST","page="+page,function(data){
			document.getElementById(imgid).innerHTML = data;
			var a=data.substring(0,data.indexOf("</span>"));
			var b=a.substring(a.indexOf(">")+1);
			document.getElementById("image_size_id").value=b;
		});
}

</script>




<script type="text/javascript" src="<?php echo $this->_webroot('servtools/jquery-1.3.2.min.js?v=1.3.2'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('servtools/xheditor/xheditor.min.js?v=1.0.0-final'); ?>"></script>
<link href="<?php echo $this->_webroot('servtools/swfupload/css/default.css'); ?>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo $this->_webroot('servtools/swfupload/swfupload.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('servtools/swfupload/swfupload.queue.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('servtools/swfupload/fileprogress.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('servtools/swfupload/handlers.js'); ?>"></script>
<script type="text/javascript">
		var swfu;

		window.onload = function() {
			var settings = {
				flash_url : "<?php echo $this->_webroot('servtools/swfupload/swfupload.swf'); ?>",
				upload_url: "<?php echo $this->_url('post/swfupload');?>",
				post_params: {"<?php echo Param::read('Session.postOrGetIdName');?>" : "<?php echo $ps; ?>","gcv":"881257c8fab1044a7f6082c12fe4ee92"},
				file_size_limit : "1 MB",
				file_types : "*.jpg;*.jpge;*.png;*.gif",
				file_types_description : "images Files",
				file_upload_limit : 30,
				file_queue_limit : 30,
				file_post_name:"Filedata[]",
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,

				
				button_image_url: "<?php echo $this->_webroot('servtools/swfupload/images/TestImageNoText_65x29.png'); ?>",
				button_width: "65",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_text: '<span class="theFont">�ϴ�ͼƬ</span>',
				button_text_style: ".theFont { font-size: 12; }",
				button_text_left_padding: 5,
				button_text_top_padding: 3,
				button_window_mode : SWFUpload.WINDOW_MODE.OPAQUE,
				button_cursor : SWFUpload.CURSOR.HAND,
				
				
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadGoodsSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);

	     };
	</script>
<script type="text/javascript">
var introeditor;
$(function(){
	introeditor=$("#goods_intro").xheditor({skin:'vista',tools:"Cut,Copy,Paste,Pastetext,Separator,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Unlink,Img,Table,Separator,Fullscreen,About"});
	$("#goods_intro").val("");
});

function introimage(id,imagepath){
	var is=$("#image_size_id").val();
	if(is==""){
		$("#image_size_id").val(id);
	}else{
		$("#image_size_id").val(is+","+id);
	}
	var imagestr="<li id='imgli'><p class='photo'><img src="+imagepath+" width='100' height='100' /></p><p><a href='javascript:;'  onclick='return addIntroImg(this)' >����</a><a href='javascript:;' name='"+id+"' onclick='return delIntroImg(this)'>ɾ��</a></p></li>";
	$("#introimage").append(imagestr);

}

function addIntroImg(obj){
    var li=$(obj).parent().parent().children(".photo").children("img").attr("src");
    var str=li.substring(li.indexOf("uploadfiles"));
	introeditor.appendHTML("<img src="+str+"/>");
	return false;
}

function delIntroImg(obj){
	if(!confirm('�����Ҫɾ������ͼƬ��?')){
       return;
		}
	var path=$(obj).parent().parent().children(".photo").children("img").attr("src");
	var is=$("#image_size_id").val();
	var iid=$(obj).attr('name');
	if(is==""){
		return;
	}
    var param={
          iid:iid,
          path:path
    	  };
    $.post("<?php echo $this->_url('post/swfdelimage');?>",param,function(data){
        if(data=='1'){
            	var is=$("#image_size_id").val();
          		var myArray=is.split(",");
          		var a;
          		for(i=0;i<myArray.length;i++){
                      if(myArray[i]==iid){
                      	a=i;
                      	break;
                        }
          		}
          		myArray.splice(a,1);
          		var isid=myArray.join(",");
          		$("#image_size_id").val(isid);
          		$(obj).parent().parent().remove();
             }else{
                alert('ɾ��ʧ��');
                 }
        });
}

function AddContentImg(ImgName,classId){
	var obj = document.getElementById("goods_intro").previousSibling.children[0];
	obj.innerHTML = obj.innerHTML + "<br><IMG src='./"+ImgName+"' /><br>";
}

function checkForm() {
	var goods_name = document.getElementsByName("goods_name")[0];
	var goods_price = document.getElementById("goods_price");
	var transport_price = document.getElementById("transport_price");
	var goods_number = document.getElementById("goods_number");

	var num = /^[0-9]+(.[0-9]*)?$/;

	if (document.getElementsByName("cat_id")[0].value==0){
		alert("��ѡ����࣡");
		return false;
	} else if(goods_name.value==''){
		alert("��Ʒ���Ʋ���Ϊ�գ�");
		goods_name.focus();
		return false;
	}
	if (goods_price.value !=''){
		if (!goods_price.value.match(num)){
			alert('��Ʒ�۸��ʽ����ȷ');
			goods_price.focus();
			return false;
		}
	}
	if(transport_price.value !=''){
		if (!transport_price.value.match(num)){
			alert("�˷Ѹ�ʽ����ȷ");
			transport_price.focus();
			return false;
		}
	}
	if (goods_number.value !=''){
		if(!goods_number.value.match(num)){
			alert('����ʽ����ȷ');
			goods_number.focus();
			return false;
		}
	}
	return true;
}   

</script>


<style>

.main_right {
    width: 690px;
    float: left;
}

textright {
   text-align : right;
}
.index_tab {
    margin-top: 10px;
}

.index_tab ul {
    clear: both;
    margin: 0px;
    padding: 0px;
}
.index_tab ul li {
    float: left;
    margin-right: 3px;
    width: 100px;
    height: 30px;
    position: relative;
    list-style: none outside none;
    text-align: center;
    line-height: 30px;
}

.index_tab ul li a:hover, .index_tab ul li .current {
    background: none repeat scroll 0% 0% rgb(255, 255, 255);
    border-width: 1px 1px 0px;
    border-style: solid solid none;
    border-color: rgb(236, 236, 236) rgb(236, 236, 236) -moz-use-text-color;
    -moz-border-top-colors: none;
    -moz-border-right-colors: none;
    -moz-border-bottom-colors: none;
    -moz-border-left-colors: none;
    -moz-border-image: none;
}
.index_tab ul li a {
    border-right: 1px solid rgb(236, 236, 236);
    border-width: 0px 1px 1px;
    border-style: none solid solid;
    border-color: -moz-use-text-color rgb(236, 236, 236) rgb(236, 236, 236);
    -moz-border-top-colors: none;
    -moz-border-right-colors: none;
    -moz-border-bottom-colors: none;
    -moz-border-left-colors: none;
    -moz-border-image: none;
    display: block;
    height: 28px;
    padding-top: 2px;
    font-weight: bold;
    font-size: 14px;
    background: url("../images/memberlist_th_bg.gif") repeat-x scroll center top transparent;
    position: relative;
    bottom: -1px;
}
.main_right table a {
    color: rgb(247, 122, 7);
    text-decoration: underline;
}
.tab_box {
    border: 1px solid rgb(236, 236, 236);
    overflow: hidden;
    padding: 8px 10px;
    width: 740px;
    margin-top: 4px;
}
.main_right table a {
    color: rgb(247, 122, 7);
    text-decoration: underline;
}
.main_right table textarea {
    border: 1px solid rgb(153, 153, 153);
}
.main_right table input[type="text"] {
    border: 1px solid rgb(153, 153, 153);
    padding: 3px 0px 0px 3px;
    width: 150px;
}
.main_right table span {
    color: rgb(255, 102, 0);
    font-weight: bold;
}
.imgPan {
    width: 570px;
    overflow: hidden;
}
.imgPan li {
    float: left;
    text-align: center;
}
.imgPan li .photo {
    width: 100px;
    height: 100px;
    margin-right: 10px;
    border: 1px solid rgb(204, 204, 204);
}
.imgPan li p {
    margin-bottom: 10px;
}
.pagenav .upPage, .pagenav .nextPage {
    width: 52px;
    color: rgb(170, 170, 170);
    text-decoration: none;
}
.pagenav a.num {
    color: rgb(170, 170, 170);
    text-decoration: none;
}

.pagenav .now {
    background-color: rgb(238, 238, 238);
    color: rgb(170, 170, 170);
}

</style>
<form id="UserRegisterForm" method="post" action="<?php echo $this->_url('post/add');?>">
    <div class="main_right">
				<table width="100%" style="border:0" cellspacing="0">
						
					<tr>
					    <td valign="top" class="textright">��Ʒ���ܣ�</td>
						<td style=" line-height:18px">
			                <div class="index_tab">
			                	<ul>
			                      <li><a id="style1" style="font-size:12px;color:#333;font-weight:normal; text-decoration:none" class="current" href="javascript:;" onclick="change_style('style1')">��Ʒ����</a></li>
			                      <li><a id="style2" style="font-size:12px;color:#333;font-weight:normal;text-decoration:none" href="javascript:;" onclick="change_style('style2');get_img_list('img_select3','2','img_list3',this)">ʹ�����ϴ�ͼƬ</a></li>
			                    </ul>
			                </div>
			                <div id="display_order" class="tab_box">
								<textarea name="goods_intro" id="goods_intro" cols="65" rows="15"></textarea>
								<div><span>����ϴ�������ͼƬ</span></div>
								<div id="img_select2" style="width:600px;">
			                    	<div id="img_list2" class="imgPan">
										<ul id="introimage" class="clearfix"></ul>
			                    	</div>
								</div>
						        <div id="fsUploadProgress"></div>
						        <div id="divStatus"></div>
						        <div>
							        <span id="spanButtonPlaceHolder"></span>
							        <input id="btnCancel" type="button" value="ȡ��" onclick="swfu.cancelQueue();" disabled="disabled" style="display:none" />
							        <input type="hidden" id="image_size_id" name="image_size_id" value=""/>
						        </div>
						        <span >��ctrl��ѡ�����ļ�</span>
							</div>
			                <div id="display_favorite" class="tab_box" style="display:none;">
								<div id="img_select3" style="width:600px;">
			                    	<div id="img_list3" class="imgPan">
										<ul id="introimage1" class="clearfix"></ul>
			                    	</div>
								</div>
			                </div>
							
					    </td>
					</tr>
	

				</table>
</div>
<input type="submit" value="I Accept. Create My Account" />
</form>


